// 设计登录时未按规范输入报错的对话框

// 去除VSCode非必要报警
// ignore_for_file: sized_box_for_whitespace, camel_case_types, non_constant_identifier_names, must_be_immutable

import 'package:flutter/material.dart';
import 'package:project_award_statistics/pages/mobile_material_design/change_passwd_page/change_passwd_page.dart';
import 'package:project_award_statistics/utils/mobile_material_design/my_button.dart';

class DialogLoginErr_WrongPasswd extends StatelessWidget {
  String stu_name;
  DialogLoginErr_WrongPasswd ({
    super.key,
    required this.stu_name,
  });

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      backgroundColor: Theme.of(context).colorScheme.surface,
      content: Container(
        height: 290,
        width: 500,
        child: Padding(
          padding: const EdgeInsets.only(left: 0.0,right: 0.0),
          child: Column(   // 设置列式布局容器
            mainAxisAlignment: MainAxisAlignment.spaceBetween,   // 使用相对布局防止在不同分辨率手机上运行出现问题
            children: [
              Center(
                child: Text(
                  "登录错误",
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              // SizedBox(height: 26,),   // 这里由于设置了相对布局,故不再设置控件间距离,同下
              Text(
                "您输入的用户名或密码有误,请重新检查您的输入!",
                style: TextStyle(
                  fontSize: 18,
                ),
              ),
              // SizedBox(height: 30,),
              Column(     // 行式布局放置两个按钮
                children: [
                  SizedBox(
                    height: 43,
                    width: 150,
                    child: MyButton(
                      text: "哎呀,我忘记密码了", 
                      onPressed: (){
                        Navigator.of(context).pop();  // 先退出当前对话框
                        Navigator.push(
                          context,
                          MaterialPageRoute(
                            builder:(context)=>ChangePasswdPage_Mobile(stu_name:stu_name,),
                          ),
                        );
                      },
                    ),
                  ),
                  const SizedBox(height: 25,),
                  SizedBox(
                    height: 43,
                    width: 150,
                    child: MyButton(
                      text: "好的,我马上去检查", 
                      onPressed: ()=>Navigator.of(context).pop(),
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}